// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import router from './router'
import axios from 'axios' /*引入 axios*/
import $ from 'jquery' /*引入jquery*/
import wx from 'weixin-js-sdk'
import '../static/css/base.css' /*引入公共样式*/
import md5 from 'js-md5'; /*MD5加密*/
import './assets/iconfont/iconfont.css' /*引入文字图标样式*/
import VueWechatTitle from 'vue-wechat-title' /*设置头部标题*/
//import 'amfe-flexible'
axios.defaults.withCredentials = true; /*让ajax携带cookie*/
let base = 'http://api.heruinet.com';
import { Indicator } from 'mint-ui';
Vue.config.productionTip = false
Vue.prototype.$http = axios /*axios 改写为 Vue 的原型属性*/
axios.defaults.withCredentials=true;
Vue.prototype.$md5 = md5
Vue.prototype.$Indicator = Indicator
Vue.use(ElementUI)
Vue.use(wx)
Vue.use(VueWechatTitle)

Vue.prototype.baseURL = base;

/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	components: {
		App
	},
	template: '<App/>'
})
// router.beforeEach((to, from, next) => {
// 	if(to.meta.requireAuth) { // 判断该路由是否需要登录权限
// 		if(localStorage.getItem('key')) { // 通过vuex state获取当前的token是否存在,通过一个变量（vuex中或localstorage中），如果为真，那么跳转
// 
// 			next();
// 		} else {
// 			next({
// 				path: '/', //如果为假，则重定向到这个路由路劲
// 				query: {
// 					redirect: to.fullPath
// 				} // 将跳转的路由path作为参数，登录成功后跳转到该路由
// 			})
// 		}
// 	} else {
// 		next()
// 	}
// })